fix 181: Admin API Exposed in Client Code#198
fix 181: Admin API Exposed in Client Code#198Karelaking wants to merge 4 commits intoTiwariDivya25:mainfrom
Conversation
|
@Karelaking is attempting to deploy a commit to the Divya Tiwari's projects Team on Vercel. A member of the Team first needs to authorize it. |
✅ Deploy Preview for tiwaridivya25-devconnect ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Thanks for creating a PR for your Issue!
|
There was a problem hiding this comment.
Pull request overview
Fixes a client-side security issue by removing use of Supabase Admin API calls from CreateConversationModal and replacing them with a non-admin query intended to respect database RLS, plus some small safety/formatting tweaks.
Changes:
- Replaced
supabase.auth.admin.listUsers()with aProfilestable query for user selection. - Added a backend-availability guard before attempting to fetch users.
- Mapped profile rows into the component’s local
Usershape and tightened formatting.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const mappedUsers = (data || []).map(profile => ({ | ||
| id: profile.id, | ||
| email: '', // Email not exposed for privacy | ||
| user_metadata: { | ||
| full_name: profile.full_name, |
There was a problem hiding this comment.
Profiles are mapped with email: '' for privacy, but the component later searches and renders user.email as if it’s meaningful. This makes email search ineffective and can yield blank UI output. Consider either (1) removing email-based filtering/rendering when email is empty, or (2) adding a non-sensitive, non-empty identifier (e.g., username) to the fetched profile fields and using that instead.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@Karelaking Currently we are not accepting any more backend changes, this PR will be reviewed shortly. Please feel free to work on UI changes and thank you for the PR and patience! |
📝 Description
Fix critical security vulnerability in
CreateConversationModalthat exposed admin API to client-side code. Replaced dangeroussupabase.auth.admin.listUsers()call with secureProfilestable query that respects RLS policies. Also added null-safety guards toResetPasswordPageto prevent crashes when Supabase is unavailable.🎯 Type of Change
🔗 Related Issues
Closes #181
📋 Changes Made
supabase.auth.admin.listUsers()with secureProfilestable query inCreateConversationModalResetPasswordPagefrom demo mode/missing env crashes🧪 Testing
Testing Steps:
🎨 Screenshots/Demo
N/A - Security fix (no visual changes)
📦 Dependencies
✅ Checklist
Code Quality
npm run lintand fixed all issuesTesting & Functionality
Documentation
Git & Commits
Breaking Changes
📝 Additional Context
Security Issue Details
CRITICAL VULNERABILITY (Fixed):
CreateConversationModalwas usingsupabase.auth.admin.listUsers()on the client sideSecurity Fix Applied:
Profilestable queryAdditional Improvements:
🔍 Reviewer Notes
Please review:
🚀 Deployment Notes
Required Database Table:
Ensure the
Profilestable exists with proper RLS policies (seedatabase-schema-messaging.sql):